new file: pixi.toml
[GalaxyCodeBases.git] / etc / whichpm / test / Option -v outputs version info
blobee12235ef2daa04b1d788e865b0c5784798dbf23
1 #!/usr/bin/env bash
3 # ---
4 # IMPORTANT: Use the following statement at the TOP OF EVERY TEST SCRIPT
5 # to ensure that this package's 'bin/' subfolder is added to the path so that
6 # this package's CLIs can be invoked by their mere filename in the rest
7 # of the script.
8 # ---
9 PATH=${PWD%%/test*}/bin:$PATH
11 # Helper function for error reporting.
12 die() { (( $# > 0 )) && echo "ERROR: $*" >&2; exit 1; }
14 # Get verbose info: name<tab>version<tab>core-status<tab>path
15 out=$(whichpm -v Data::Dumper) || die
17 # Split result into tokens.
18 IFS=$'\t' read -ra tokens <<<"$out"
20 # Make sure the 2nd token looks like a version number.
21 verToken=${tokens[1]}
22 [[ $verToken =~ ^v?[[:digit:]]+\. ]] || die "Expected version number as 2nd output field, got '$verToken'."
24 exit 0